from sqlalchemy import Column, Integer, String, text
from core.config.mysql_config import Base


class Publisher(Base):
    __tablename__ = "publisher"
    __table_args__ = {
        'mysql_engine': 'InnoDB',
        'mysql_charset': 'utf8mb4',
        'mysql_collate': 'utf8mb4_unicode_ci',
        'comment': '发布者信息表'
    }

    publisher_id = Column(Integer, primary_key=True, autoincrement=True, comment='新闻发布者唯一编号')
    publisher_name = Column(String(128, collation='utf8mb4_unicode_ci'), nullable=False, comment='发布者名称')
    publisher_url = Column(String(128, collation='utf8mb4_unicode_ci'), nullable=False, comment='发布者链接')
    publisher_location = Column(String(128, collation='utf8mb4_unicode_ci'), nullable=False, comment='发布者地址')
    publisher_total_article = Column(Integer, nullable=False, server_default=text('0'), comment='累计文章数量')
    publisher_total_fans = Column(Integer, nullable=False, server_default=text('0'), comment='粉丝总数')

